﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master/admin.master" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="SocialShare.Web.Admin._default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
 <script src="<%= Utilities.SiteSettings.BaseUrl %>scripts/Charts/js/highcharts.js" type="text/javascript"></script>
 <link rel="stylesheet" href="<%= Utilities.SiteSettings.BaseUrl %>scripts/Grid/loader.css">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script type="text/javascript">
    $(document).ready(function () {
        Report1();
        Report2();
        Report3();
        Report4();
    });

    function Report4() {
        var store;
        $.ajax({
            type: "POST",
            url: "default.aspx/Report4",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            beforeSend: function () { $("#wait").show(); },
            complete: function () { $("#wait").hide(); },
            success: function (msg) {
                ChartReport4(eval(msg.d));

            },
            error: function () { }
        });
    }

    function ChartReport4(store) {

        var caption_array = new Array();
        var total_array = new Array();
        for (i = 0; i < store.length; i++) {

            caption_array[i] = store[i].Caption;
            total_array[i] = store[i].Total;
        }

        chartColumn1 = new Highcharts.Chart({
            chart: {
                renderTo: 'report4',
                defaultSeriesType: 'column'
            },
            title: {
                text: ''
            },
            xAxis: {
                categories: caption_array
            },
            yAxis: {
                min: 0,
                title: {
                    text: ''
                }
            },
            legend: {
                enabled: false
            },
            tooltip: {
                formatter: function () {
                    return '<b>' + this.x + '</b><br/>' +
								 'Total: ' + this.point.stackTotal;
                }
            },
            plotOptions: {
                column: {
                    stacking: 'normal'
                }
            },
            series: [{
                name: "",
                data: total_array
            }]
        });
    }

    function Report3() {
        var store;
        $.ajax({
            type: "POST",
            url: "default.aspx/Report3",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            beforeSend: function () { $("#wait").show(); },
            complete: function () { $("#wait").hide(); },
            success: function (msg) {
                ChartReport3(eval(msg.d));

            },
            error: function () { }
        });
    }

    function ChartReport3(store) {

        var caption_array = new Array();
        var total_array = new Array();
        for (i = 0; i < store.length; i++) {

            caption_array[i] = store[i].Caption;
            total_array[i] = store[i].Total;
        }

        chartColumn1 = new Highcharts.Chart({
            chart: {
                renderTo: 'report3',
                defaultSeriesType: 'column'
            },
            title: {
                text: ''
            },
            xAxis: {
                categories: caption_array
            },
            yAxis: {
                min: 0,
                title: {
                    text: ''
                }
            },
            legend: {
                enabled: false
            },
            tooltip: {
                formatter: function () {
                    return '<b>' + this.x + '</b><br/>' +
								 'Total: ' + this.point.stackTotal;
                }
            },
            plotOptions: {
                column: {
                    stacking: 'normal'
                }
            },
            series: [{
                name: "",
                data: total_array
            }]
        });
    }

    function Report2() {
        var store;
        $.ajax({
            type: "POST",
            url: "default.aspx/Report2",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            beforeSend: function () { $("#wait").show(); },
            complete: function () { $("#wait").hide(); },
            success: function (msg) {
                ChartReport2(eval(msg.d));

            },
            error: function () { }
        });
    }

        function ChartReport2(store) {

           chart2 = new Highcharts.Chart({
                 chart: {
                     renderTo: 'report2',
                     plotBackgroundColor: null,
                     plotBorderWidth: null,
                     plotShadow: true,
                     shadhow: true,
                     marginTop: 0,
                     width: 350,
                     height: null,
                     className: "charts-1",
                     spacingTop: 100

                 },
                 legend: {
                     enabled: false
                 },
                 exporting: {
                     enabled: false
                 },
                 title: {
                     text: ''
                 },
                 tooltip: {
                     formatter: function () {
                         return '<b>' + this.point.name + '</b>: ' + this.y
                     }
                 },
                 plotOptions: {
                     pie: {
                         allowPointSelect: true,
                         cursor: 'pointer',
                         dataLabels: {
                             enabled: false
                         },
                         showInLegend: true
                     }
                 },
                 series: [{
                     type: 'pie',
                     name: 'Enrollment',
                     data:store
                 }]
             });

        }
        function Report1() {
            var store;
            $.ajax({
                type: "POST",
                url: "default.aspx/Report1",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                beforeSend: function () { $("#wait").show(); },
                complete: function () { $("#wait").hide(); },
                success: function (msg) {
                    ChartReport1(eval(msg.d));

                },
                error: function () { }
            });
        }

        function ChartReport1(store) {

            var caption_array = new Array();
            var total_array = new Array();
            for (i = 0; i < store.length; i++) {

                caption_array[i] = store[i].Caption;
                total_array[i] = store[i].Total;
            }
            
            chartColumn1 = new Highcharts.Chart({
                chart: {
                    renderTo: 'report1',
                    defaultSeriesType: 'column'
                },
                title: {
                    text: ''
                },
                xAxis: {
                    categories: caption_array
                },
                yAxis: {
                    min: 0,
                    title: {
                        text: ''
                    }
                },
                legend: {
                    enabled: false
                },
                tooltip: {
                    formatter: function () {
                        return '<b>' + this.x + '</b><br/>' +
								 'Total: ' + this.point.stackTotal;
                    }
                },
                plotOptions: {
                    column: {
                        stacking: 'normal'
                    }
                },
                series: [{
                    name: "",
                    data: total_array
                }]
            });
        }
    
</script>

<section class="grid_12 clearfix omega">
<section class="grid_12 clearfix omega">
<section id="wait" class="progress grid_5">
  <section class="progress-container">
        <section class="progress-header">Loading, please wait...</section>
        <section class="progress-body">
            <img src="../Scripts/Grid/pre-loader.gif" />
        </section>
    </section>
  
  </section>
  <section class="grid_7">
  &nbsp;
  </section>

</section>

<section class="grid_12 alpha">
<section class="grid_6 alpha">
<section class="grid_6 ui-header-box">
Total Forum Posts# by Categories
</section>
<section id="report1" class="grid_6">
</section>
</section>
<section class="grid_6 omega">
<section class="grid_6 ui-header-box">
Approve/Disapprove Blog Posts
</section>
<section id="report2" class="grid_6">
</section>
</section>
<section class="grid_6 alpha">
<section class="grid_6 ui-header-box">
Total Blog Posts by Month
</section>
<section id="report3" class="grid_6">
</section>
</section>
<section class="grid_6 omega">
<section class="grid_6 ui-header-box">
Total Forum Posts by Month
</section>
<section id="report4" class="grid_6">
</section>
</section>
</section>
</asp:Content>
